using System;
using System.Data;

/// <summary>
/// Summary description for ControlHelper
/// </summary>
public partial class ControlHelper
{
	SqlServerProvider sqlServerProvider;
    public ControlHelper( )
    {
        
    }
    public ControlHelper(string connectionString)
    {        
        
        sqlServerProvider = new SqlServerProvider(connectionString);
    }
    
    #region Properties


    private string commandText = "";
    public string CommandText
    {
        set { commandText = value; }
        get { return commandText; }
    }
    
    private CommandType commandType;
    public CommandType CommandType
    {
        set { commandType = value; }
        get { return commandType; }
    }

    private string[] parameterCollection;
    public string[] ParameterCollection
    {
        set { parameterCollection = value; }
        get { return parameterCollection; }
    }

    private string[] valueCollection;
    public string[] ValueCollection
    {
        set { valueCollection = value; }
        get { return valueCollection; }
    }     
    
    public void InitProperties()
    {
        sqlServerProvider.CommandText = commandText;
        sqlServerProvider.CommandType = commandType;        
        sqlServerProvider.ParameterCollection = parameterCollection;
        sqlServerProvider.ValueCollection = valueCollection;         
    }
    public void Finalize()
    {
        sqlServerProvider.CloseConnection();
    }
    public int GetTotalRecords()
    {
        int totalRecord = 0;
        object obj = sqlServerProvider.ExecuteScalar();
        if (obj != null) totalRecord = Convert.ToInt32(obj);
        return totalRecord;
    }
    #endregion
}
